//
//  BaseTableViewController.swift
//  SinaWeibo
//
//  Created by Yuan on 16/4/8.
//  Copyright © 2016年 Yuan. All rights reserved.
//

import UIKit

//在oc中没有多继承，用协议代替
//协议是必选方法，必须要实现
class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate {
    
    
    var visitorLoginView: VisitorLoginView?
    
    
    //添加用户是否登录标记
    var userLogin = false
    
    override func loadView() {
        userLogin ? loadView() : loadVisitorView()
    }
    private func loadVisitorView(){
        
        visitorLoginView = VisitorLoginView()
     
        visitorLoginView?.visitorDelegate = self
        view = visitorLoginView
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "visitorWillRegister")
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "visitorWillLogin")
        
        
        
        
    }
    func visitorWillLogin() {
        print("123")
    }
    func visitorWillRegister() {
        print("456")
    }
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }

}
